package com.reder.practice;

import com.reder.practice.resolver.SessionUserMethodArgumentResolver;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.PropertySource;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

@EnableTransactionManagement
@SpringBootApplication
@MapperScan(basePackages = {
        "com.reder.practice.dao"
})
@PropertySource(value = "classpath:properties/const.properties")
@ServletComponentScan
public class PracticeApplication implements WebMvcConfigurer {

    public static void main(String[] args) {
        SpringApplication.run(PracticeApplication.class, args);
    }

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
        resolvers.add(new SessionUserMethodArgumentResolver());
    }
}
